package cars;

import java.util.Scanner;

public class RentMgrSys {
    public static void main(String[] args) {
        Car car = new Car();
        Bus bus = new Bus();
        Trunk trunk = new Trunk();
        int choose1, choose2, choose3, day = 0, seats,tonnage;
        Scanner sc = new Scanner(System.in);
        System.out.println("********欢迎光临汽车租赁公司**********");
        System.out.println("1.轿车   2.客车   3.卡车");
        System.out.print("请选择你要租赁的汽车类型:");
        choose1 = sc.nextInt();
        if (choose1 == 1) {
            System.out.println("1.宝马       2.别克");
            System.out.print("请选择你要租赁的轿车品牌：");
            choose2 = sc.nextInt();
            if (choose2 == 1) {
                while (true) {
                    System.out.println("1.550i  2.X6");
                    System.out.print("请输入你要租赁的轿车车型：");
                    choose3 = sc.nextInt();
                    System.out.print("请输入您要租赁的天数：");
                    day = sc.nextInt();
                    if (choose3 == 1) {
                        System.out.println("分配给您的汽车牌号是: 京CNY3284");
                        car.setPerRent(600);
                        System.out.println("您需要支付的租赁费用为:" + car.calRent(day) + "元");
                        break;
                    } else if (choose3 == 2) {
                        System.out.println("分配给您的汽车牌号是: 京NY28588");
                        car.setPerRent(800);
                        System.out.println("您需要支付的租赁费用为:" + car.calRent(day) + "元");
                        break;
                    } else {
                        System.out.println("输入错误，请重新输入");
                    }
                }
            } else if (choose2 == 2) {
                while (true) {
                    System.out.println("1.林荫大道  2.GL8");
                    System.out.print("请输入你要租赁的轿车车型：");
                    choose3 = sc.nextInt();
                    System.out.print("请输入您要租赁的天数：");
                    day = sc.nextInt();
                    if (choose3 == 1) {
                        System.out.println("分配给您的汽车牌号是: 京NT37465");
                        car.setPerRent(300);
                        System.out.println("您需要支付的租赁费用为:" + car.calRent(day) + "元");
                        break;
                    } else if (choose3 == 2) {
                        System.out.println("分配给您的汽车牌号是: 京NT96968");
                        car.setPerRent(600);
                        System.out.println("您需要支付的租赁费用为:" + car.calRent(day) + "元");
                        break;
                    } else {
                        System.out.println("输入错误，请重新输入");
                    }
                }
            }
        } else if (choose1 == 2) {
            System.out.println("1.金杯     2.金龙");
            System.out.print("请选择你要租赁的客车品牌:");
            choose2 = sc.nextInt();
            if (choose2 == 1) {
                System.out.print("请输入客车的座位数:");
                seats = sc.nextInt();
                if (seats <= 16) {
                    System.out.print("请输入您要租赁的天数:");
                    day = sc.nextInt();
                    System.out.println("分配给您的汽车牌号是: 京6566754");
                    bus.setPerRent(800);
                    System.out.print("您需要支付的租赁费用是:" +
                            bus.calRent(day) + "元");
                } else {
                    int count1 = seats/16;
                    System.out.print("请输入您要租赁的天数:");
                    day = sc.nextInt();
                    System.out.println("分配给您的汽车牌号是: 京8696997");
                    bus.setPerRent(800);
                    System.out.print("您需要支付的租赁费用是:" + count1*
                            bus.calRent(day) + "元");
                }
            } else if (choose2 == 2) {
                System.out.print("请输入客车的座位数:");
                seats = sc.nextInt();
                if (seats <= 34) {
                    System.out.print("请输入您要租赁的天数:");
                    day = sc.nextInt();
                    System.out.println("分配给您的汽车牌号是: 京9696996");
                    bus.setPerRent(1500);
                    System.out.print("您需要支付的租赁费用是:" +
                            bus.calRent(day) + "元");
                } else {
                    int count1 = seats/16;
                    System.out.print("请输入您要租赁的天数:");
                    day = sc.nextInt();
                    System.out.println("分配给您的汽车牌号是: 京8696998");
                    bus.setPerRent(1500);
                    System.out.print("您需要支付的租赁费用是:" + count1 *
                            bus.calRent(day) + "元");
                }
            }
        } else if (choose1 == 3) {
            System.out.println("1.解放     2.东风");
            System.out.print("请选择你要租赁的卡车品牌:");
            choose2 = sc.nextInt();
            if(choose2 == 1){
                System.out.print("请输入需要的卡车吨数:");
                tonnage = sc.nextInt();
                System.out.print("请输入您要租赁的天数:");
                day = sc.nextInt();
                System.out.println("分配给您的汽车牌号是: 冀D79846");
                trunk.setPerRent(50);
                System.out.print("您需要支付的租赁费用是:" +
                        tonnage*trunk.calRent(day) + "元");
            } else if (choose2 == 2) {
                System.out.print("请输入需要的卡车吨数:");
                tonnage = sc.nextInt();
                System.out.print("请输入您要租赁的天数:");
                day = sc.nextInt();
                System.out.println("分配给您的汽车牌号是: 135151");
                trunk.setPerRent(60);
                System.out.print("您需要支付的租赁费用是:" +
                        tonnage*trunk.calRent(day) + "元");
            }
        }
    }
}
